package vn.com.boko.book.dao;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.DaoConfig;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.IdentityScopeType;

import vn.com.boko.book.dao.Website;
import vn.com.boko.book.dao.Manga;
import vn.com.boko.book.dao.Chapter;

import vn.com.boko.book.dao.WebsiteDao;
import vn.com.boko.book.dao.MangaDao;
import vn.com.boko.book.dao.ChapterDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig websiteDaoConfig;
    private final DaoConfig mangaDaoConfig;
    private final DaoConfig chapterDaoConfig;

    private final WebsiteDao websiteDao;
    private final MangaDao mangaDao;
    private final ChapterDao chapterDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        websiteDaoConfig = daoConfigMap.get(WebsiteDao.class).clone();
        websiteDaoConfig.initIdentityScope(type);

        mangaDaoConfig = daoConfigMap.get(MangaDao.class).clone();
        mangaDaoConfig.initIdentityScope(type);

        chapterDaoConfig = daoConfigMap.get(ChapterDao.class).clone();
        chapterDaoConfig.initIdentityScope(type);

        websiteDao = new WebsiteDao(websiteDaoConfig, this);
        mangaDao = new MangaDao(mangaDaoConfig, this);
        chapterDao = new ChapterDao(chapterDaoConfig, this);

        registerDao(Website.class, websiteDao);
        registerDao(Manga.class, mangaDao);
        registerDao(Chapter.class, chapterDao);
    }
    
    public void clear() {
        websiteDaoConfig.getIdentityScope().clear();
        mangaDaoConfig.getIdentityScope().clear();
        chapterDaoConfig.getIdentityScope().clear();
    }

    public WebsiteDao getWebsiteDao() {
        return websiteDao;
    }

    public MangaDao getMangaDao() {
        return mangaDao;
    }

    public ChapterDao getChapterDao() {
        return chapterDao;
    }

}
